#pragma once
#include <string>
#include <fstream>
#include <mutex>
#include <condition_variable>
#include <atomic>
#include <thread>
#include "Message.h"
class LogMsg {
public:
    ~LogMsg();
    void init(std::string logFile);
    void appendMsg(const Message& msg);
    void run();
    void stop();
private:
    std::ofstream ofs;
    std::string strMsg;
    std::mutex mutex_;
    std::condition_variable cond_;
    std::atomic_bool running_;
    std::thread thread_;
};